<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>登录</title>
    <link rel="stylesheet" href="../css/style1.css">
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/iconfont.css">
    <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
    <style>
        html,
        body {
            min-height: 0 !important;
        }

        .tab_content {
            width: 300px;
            margin: 0 auto;
        }
    </style>
</head>

<body style="padding-bottom: 0 !important;">
    <!-- <div class="longinput">
<div>原手机号：</div>
<input type="text" name="" id="">
</div>
<div class="longinput">
<div>新手机号：</div>
<input type="text" name="" id="">
</div>
<div class="shortinput">
<div>验证码：</div>
<input type="text" name="" id="">
</div> -->
    <div class="tab_content">
        <ul>
            <li class="tabs" style="">
                <div class="input">
                    <dl>
                        <input type="password" style="background: url(../../../../footballAssociation/zuxie/img/mima.png) no-repeat left;background-size: 7% 45%;
    background-position: 4% 56%;" class="password password1" value="" name="tel" placeholder="请输入旧密码">
                    </dl>
                    <dl>
                        <input type="password" style="background: url(../../../../footballAssociation/zuxie/img/mima.png) no-repeat left;background-size: 7% 45%;
    background-position: 4% 56%;" class="password password2" name="smsCode" value="" placeholder="请输入新密码">
                    </dl>
                    <dl>
                        <input type="password" style="background: url(../../../../footballAssociation/zuxie/img/mima.png) no-repeat left;background-size: 7% 45%;
    background-position: 4% 56%;" class="password password3" value="" name="tel" placeholder="请再次输入新密码">
                    </dl>
                    <button class="login_btn login_btn2">修改</button>
                </div>
            </li>
        </ul>
    </div>


</body>
<script src="../js/jquery.min.js"></script>
<script src="../lib/layui/layui.js"></script>
<script src="../js/base.js"></script>
<script>
    layui.use(['table', 'laydate'], function () {
        $('.login_btn2').click(function () {
            var password1 = $(".password1").val();
            var password2 = $(".password2").val();
            var password3 = $(".password3").val();
            if ($(".password1").val() == "" || $(".password1").val() == undefined) {
                layer.msg('请输入旧密码')
                return false;
            } else if ($(".password2").val() == "" || $(".password2").val() == undefined) {
                layer.msg('请输入新密码')
                return false;
            } else if ($(".password3").val() == "" || $(".password3").val() == undefined) {
                layer.msg('请再次输入新密码')
                return false;
            }


            $.ajax({
                url: updatePassword,
                type: 'post',
                data: {
                    oldPassword: password1,
                    newPassword: password2,
                    confirmPassword: password3
                },
                success: function (data) {
                    if (data.msg == "您当前暂未登录，请登录后在操作") {
                        layer.alert(data.msg, {
                            title: "提示",
                            cancel: function () {
                                parent.parent.window.location.href =
                                    "http://newtest.sdfa.org.cn/footballAssociation/footBallAdmin/login.html"
                            }
                        }, function () {
                            parent.parent.window.location.href =
                                "http://newtest.sdfa.org.cn/footballAssociation/footBallAdmin/login.html"
                        });
                        return false
                    }
                    if (data.msg == "0") {
                        layer.alert('修改成功', {
                            title: '提示',
                            cancel: function () {
                                var index = parent.parent.layer.getFrameIndex(
                                    window
                                    .name); //先得到当前iframe层的索引
                                parent.parent.document.querySelector(
                                        "#loginout")
                                    .click() //再执行关闭  
                            }
                        }, function () {
                            var index = parent.parent.layer.getFrameIndex(window
                                .name); //先得到当前iframe层的索引
                            parent.parent.document.querySelector("#loginout")
                                .click() //再执行关闭  
                        })
                    } else {
                        layer.alert(data.msg, {
                            title: '提示'
                        })
                    }
                },
                error: function (data) {
                    console.log(data)
                    layer.alert(data.msg, {
                        title: '提示'
                    })
                }
            });
        });
    })
</script>

</html>